home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 September / CHIP Eylül 1998.iso / Slackwar / docs / Busmouse-HOWTO < prev    next >
Text File  |  1997-02-03  |  21KB  |  501 lines

  1.   The Linux Busmouse Howto
  2.   Chris Bagwell, cbagwell@sprynet.com
  3.   v1.07, 1 February 1998
  4.  
  5.   1.  Introduction.
  6.  
  7.   This document is a guide to getting your busmouse working with Linux.
  8.   During early kernel versions it was quite common to see questions come
  9.   up about how to get bus mice working under Linux.  With the more
  10.   advanced distributions available today the questions do not seem to
  11.   come up as often but there still seems to be an audience for this FAQ.
  12.  
  13.   Busmouse support has been in the kernel for as long as I can remember,
  14.   and hasn't changed much in a long time, so this document should be
  15.   relevant to any version of Linux you're likely to have.
  16.  
  17.   1.1.  Disclaimer.
  18.  
  19.   The information in this document is correct to the best of my
  20.   knowledge, but there's a always a chance I've made some mistakes, so
  21.   don't follow everything too blindly, especially if it seems wrong.
  22.   Nothing here should have a detrimental effect on your computer, but
  23.   just in case I take no responsibility for any damages incurred from
  24.   the use of the information contained herein.
  25.  
  26.   Microsoft(R) is a Trademark of Microsoft Corporation.
  27.  
  28.   [ trademark notices for other mice, anyone? ]
  29.  
  30.   1.2.  Feedback.
  31.  
  32.   If you find any mistakes in this document, have any comments about its
  33.   contents or an update or addition, send them to me at the address
  34.   listed at the top of this howto.
  35.  
  36.   1.3.  Acknowledgements.
  37.  
  38.   This howto has been, in the spirit of Linux, a community effort.
  39.   Thanks goes out to Mike Battersby, mib@deakin.edu.au as he started
  40.   this FAQ and I have since started up-keep on it.  Any errors are most
  41.   likely mine.
  42.  
  43.   Many thanks go to Johan Myreen for the sections on the PS/2 mice,
  44.   Robert T. Harris for help on the ATI-XL sections and Reuben Sumner for
  45.   miscellaneous info and constructive criticism.
  46.  
  47.   Thanks also to the multitudes of people who have sent me mouse
  48.   information, fixes or words of encouragement.
  49.  
  50.   2.  Determining your mouse type.
  51.  
  52.   There are two separate but important characteristics you will need to
  53.   know about your mouse before you go on: what mouse interface it uses
  54.   and what mouse protocol it uses.  The interface is the hardware aspect
  55.   of the mouse, taking into account things like which i/o ports it uses
  56.   and how to check if it is installed.  This is the part which the
  57.   kernel is concerned with, so that it knows how to read data from the
  58.   mouse.  The protocol is the software aspect of the mouse.
  59.   Applications need to know the protocol to interpret the raw mouse data
  60.   they receive from the kernel.
  61.  
  62.   2.1.  Mouse interfaces.
  63.  
  64.   The Linux kernel currently supports four different kinds of bus mouse
  65.   interface : Inport (Microsoft), Logitech, PS/2 and ATI-XL.  There is
  66.   no sure-fire way of determining your mouse interface --- mouse
  67.   developers generally do their own thing when it comes to standards.
  68.   The following sections may help, otherwise you'll just have to make it
  69.   up.
  70.  
  71.   2.2.  Inport mice.
  72.  
  73.   This includes most of the old style Microsoft mice which are shaped
  74.   like a bar of dove soap.  U.S. users who have purchased Gateway
  75.   computers should note that the mice that come with them are not Inport
  76.   mice but PS/2 mice (see below).  Inport mice generally connect to an
  77.   interface card which plugs into the bus on your motherboard.  If the
  78.   plug which connects your mouse cord to the interface card is round,
  79.   has 9 pins, and a notch in one side you likely have an Inport mouse.
  80.  
  81.   As far as I can tell, apart from the ATI-XL, all ATI mice (such as
  82.   those on the Graphics Ultra cards) are plain Inport mice.
  83.  
  84.   2.3.  Logitech mice.
  85.  
  86.   Logitech mice in general appear almost exactly the same as Inport
  87.   mice.  They too connect to an interface card via a 9 pin mini-din
  88.   connector.  Hopefully, it will have come in a Logitech box or have
  89.   ``Logitech'' printed on the connector card so that you can tell it
  90.   actually is a Logitech mouse.
  91.  
  92.   There are also some truly ancient Microsoft mice (ones with ball
  93.   bearings on the bottom as well as the mouse ball and a DB9 connector)
  94.   which also use the Logitech protocol.
  95.  
  96.   2.4.  PS/2 mice.
  97.  
  98.   PS/2 mice aren't really bus mice at all.  The PS/2 mouse interface is
  99.   not on an expansion card, the mouse is connected to the PS/2 Auxiliary
  100.   Device port on the keyboard controller.  A PS/2 mouse port uses a
  101.   6-pin mini DIN connector, similar to the keyboard connector.  Many
  102.   laptops also use this kind of interface to their trackballs --- except
  103.   for the connector, of course.
  104.  
  105.   2.5.  ATI-XL mice.
  106.  
  107.   ATI-XL mice are a variant of Inport mice, with some slight
  108.   differences.  They come on the ATI-XL combined video adaptor/mouse
  109.   card.  Unless you know you have an ATI-XL card (and thus an ATI-XL
  110.   mouse), you probably don't have one of these. It is possible for ATI-
  111.   XL mice to use either the ATI-XL or Inport kernel drivers, although
  112.   the ATI-XL driver should give better results.
  113.  
  114.   2.6.  Mouse protocols.
  115.  
  116.   The PC world is full of different and conflicting mouse protocols.
  117.   Fortunately, the choice for bus mice is considerable smaller than that
  118.   for serial mice.  Most Inport, Logitech and ATI-XL mice use the
  119.   ``BusMouse'' protocol, although there are some ancient Logitech mice
  120.   which use the ``MouseSystems'' protocol, and some even older Microsoft
  121.   mice which use the ''Logitech'' protocol.  PS/2 mice use the ``PS/2''
  122.   protocol.
  123.  
  124.   3.  Getting your mouse working.
  125.  
  126.   Once you have figured out your mouse interface and protocol types,
  127.   you're ready to proceed.
  128.  
  129.   3.1.  Setting the mouse interrupt.
  130.  
  131.   Now, you'll need to know which interrupt number your mouse is using,
  132.   and make sure it doesn't conflict with any other peripherals you have
  133.   installed.
  134.  
  135.   You should make sure that your mouse is not trying to use the same
  136.   interrupt as any of your other devices --- it is not possible for the
  137.   mouse to share an interrupt under Linux, even though it may work fine
  138.   under other operating systems.  Check the documentation for all your
  139.   peripherals to see which interrupt they use.  In most cases IRQ4 is
  140.   used for the first serial port (/dev/ttyS0), IRQ3 for the second
  141.   (/dev/ttyS1) (these are assuming you actually have such devices --- if
  142.   you don't you can happily use their IRQ's), and IRQ5 for some SCSI
  143.   adaptors.
  144.  
  145.   Note that for ATI-XL, Inport and Logitech mice the kernel default is
  146.   to use IRQ5, so if you are stuck with a pre-compiled kernel (eg, CD-
  147.   ROM users) you will have to use that.  If you are using an Inport or
  148.   Logitech mice with a newer kernel you may be able to pass a command
  149.   line option to the kernel to tell it what interrupt to use without
  150.   recompiling.
  151.  
  152.   3.2.  Inport and Logitech mice.
  153.  
  154.   If you open up your computer's case and look at the card which your
  155.   mouse plugs into, you should notice a block of jumpers on the card
  156.   (hopefully labeled ``INTERRUPT'') with positions for interrupt
  157.   (otherwise known as IRQ) numbers 2,3,4 and 5.  To change the interrupt
  158.   simply move the jumper from its current position onto the correct pair
  159.   of pins.
  160.  
  161.        ***************************************************
  162.        ***     MAKE SURE YOUR COMPUTER IS TURNED OFF   ***
  163.        ***     BEFORE CHANGING THE JUMPERS AROUND.     ***
  164.        ***************************************************
  165.  
  166.   3.3.  ATI-XL mice.
  167.  
  168.   ATI-XL busmice have a software selectable IRQ - you should have
  169.   received with your mouse a MS-DOS program (VSETUP.EXE) to set the IRQ.
  170.   In order to do so you must (temporarily) boot MS-DOS and run this
  171.   program.  Note that the VSETUP program takes an optional parameter
  172.   ``/70'' to increase the vertical refresh rate (which results in less
  173.   flicker).  The VSETUP program also allows you to select either the
  174.   primary or secondary mouse address - you should set this to the
  175.   primary address or the kernel will not be able to detect your mouse.
  176.  
  177.   Once VSETUP has been run you must perform a hard reset for the new
  178.   configuration to take effect.
  179.  
  180.   3.4.  PS/2 mice.
  181.  
  182.   The PS/2 mouse always uses IRQ12 -- there is no way of changing this
  183.   (except with a soldering gun.)  In the rare case that some other
  184.   device is using IRQ12, you'll have to rejumper that peripheral to use
  185.   another IRQ number.
  186.  
  187.   3.5.  Configuring the kernel.
  188.  
  189.   In order for your busmouse to operate correctly you will need to
  190.   configure your kernel to compile in busmouse support.  If you are
  191.   using a pre-compiled kernel then it often comes with support for all
  192.   three busmouse included.  This may still not be enough.  The kernel
  193.   could be trying to use the wrong interrupt or the detection can get
  194.   confused and treat your mouse as the wrong type.  When in doubt, try
  195.   recompiling your kernel with only support for your mouse type and set
  196.   it to use the correct interrupt.
  197.  
  198.   3.5.1.  Compiling the kernel.
  199.  
  200.   Change to your kernel directory (here assumed to be (/usr/src/linux)
  201.   and do a
  202.  
  203.        make config
  204.  
  205.   If you are unsure as to your mouse type, the first time you recompile
  206.   the kernel you may wish to enable all of the busmouse options in the
  207.   hope that the kernel will autodetect your mouse properly.  People have
  208.   mixed success with this: it doesn't always work, but on the other hand
  209.   it might save you any further compiles.
  210.  
  211.   Answer ``y'' or ''m'' to the question pertaining to your type of
  212.   busmouse interface and ``n'' to all the other busmouse questions.  Use
  213.   the ''m'' option if you have your system setup to support loading
  214.   kernel modules if you do not or do not know what that means then it
  215.   will be safe to always answer ''y'' to have the support directly
  216.   compiled into your kernel.
  217.  
  218.   As an example, if you have an Inport mouse you should answer ``y'' to
  219.  
  220.        Microsoft busmouse support
  221.  
  222.   and ``n'' to all other busmouse questions.  Answer the non-mouse
  223.   related questions as you usually would.
  224.  
  225.   To compile the kernel with PS/2 mouse support answer ``y'' to the
  226.   question.
  227.  
  228.        PS/2 mouse (aka "auxiliary device") support
  229.  
  230.   The PS/2 mouse driver actually supports two kinds of devices: the
  231.   standard PS/2 Auxiliary Device controller and a special PS/2 mouse
  232.   interface chip from Chips & Technologies which is used in the Texas
  233.   Instruments Travelmate and Gateway Nomad laptops.  To compile in
  234.   support for the trackballs on these computers, answer ``y'' to the
  235.  
  236.        C&T 82C710 mouse port support (as on TI Travelmate)
  237.  
  238.   question.  Note that you will still have to answer ``y'' to the ques¡
  239.   tion about the standard PS/2 driver to even get a chance to answer
  240.   this question, since the 82C710 driver is actually an add-on to the
  241.   standard PS/2 mouse driver.
  242.  
  243.   When configured both for a standard PS/2 mouse device and the 82C710
  244.   device, the driver first tries to locate a 82C710 chip at boot time.
  245.   Failing this, the standard driver is used instead, so using a kernel
  246.   configured for both types of interface on a machine with a standard
  247.   PS/2 mouse port should work too.  However, there has been one report
  248.   of a falsely detected 82C710 chip, so to be on the safe side do not
  249.   configure in support for the 82C710 if you don't need it.
  250.  
  251.   You will now need to tell the kernel what interrupt your mouse uses.
  252.   You can skip this step if your using a PS/2 mouse as it always uses
  253.   IRQ 12.
  254.  
  255.   If you have a Logitech or Inport mouse, edit the file
  256.   /usr/src/linux/include/linux/busmouse.h and change the line which says
  257.  
  258.        #define MOUSE_IRQ               5
  259.  
  260.   to reflect the interrupt number for your mouse (see the section ``Set¡
  261.   ting the mouse interrupt'' for details on finding your interrupt num¡
  262.   ber).
  263.  
  264.   If you have an ATI-XL mouse, edit the file
  265.   /usr/src/linux/drivers/char/atixlmouse.c and change the line which
  266.   says
  267.  
  268.        #define ATIXL_MOUSE_IRQ         5
  269.  
  270.   to reflect your mouse's interrupt number.
  271.  
  272.   Due to the vagaries of the PC architecture, if you have set your mouse
  273.   to use interrupt 2, you must set the #define to use interrupt 9.
  274.  
  275.   Examples
  276.  
  277.   For a mouse on interrupt 3, you should change the line to read
  278.  
  279.   #define MOUSE_IRQ               3
  280.  
  281.   For a mouse on interrupt 2, you should change the line to read
  282.  
  283.        #define MOUSE_IRQ               9
  284.  
  285.   Next, compile your kernel as per the instructions which come with it,
  286.   and boot from the new kernel.  You should now have the busmouse
  287.   support correctly compiled in.
  288.  
  289.   3.5.2.  selection.
  290.  
  291.   It appears that in older kernels you had to compile in support to use
  292.   the program selection (a program that allows you to cut and past from
  293.   virtual consoles the same way you do under X).  This option does not
  294.   appear in modern kernels and the program selection has generally been
  295.   replaced with the program gpm (see the section ``gpm'' for more
  296.   details).
  297.  
  298.   If you are working with an old kernel then you may wish to set this
  299.   option to ``y'' regardless of your mouse type so that you may use the
  300.   selection program.
  301.  
  302.   3.5.3.  Changing interrupts with newer kernels.
  303.  
  304.   The steps to compile into the kernel what interrupt it uses works with
  305.   any version of the kernel to date.  Newer kernels (starting somewhere
  306.   in  the 2.x.x's) allow you to pass arguments to the kernel during load
  307.   time using something like LILO or LOADLIN to specify the interrupt
  308.   number for Logitech and Microsoft Inport mice.  This can be a real
  309.   time saver as you do not need to recompiler your kernel (or know how
  310.   to).  If you've configured your kernel to load the mouse drivers as
  311.   modules then you will need to pass this information when loading the
  312.   module.
  313.  
  314.   You can add the following options to your boot line in LILO to change
  315.   interrupt:
  316.  
  317.        bmouse=3  (Logitech Busmice)
  318.        msmouse=3 (for Microsoft Inport mice)
  319.  
  320.   Substitute the 3 with your mouse's actual interrupt. An example of
  321.   using this with lilo is:
  322.  
  323.        LILO:linux msmouse=3
  324.  
  325.   You can consult your LILO or LOADLIN docs to see how to add this type
  326.   information to their configuration files so that you do not need to
  327.   type it.
  328.   When using modules you can manually set the interrupt by using insmod
  329.   as follows:
  330.  
  331.        insmod msbusmouse.o mouse_irq=3    (use for Inport mice)
  332.        insmod busmouse.o mouse_irq=3      (use for Logitech mice)
  333.  
  334.   If your system uses kerneld to auto load modules, you can edit your
  335.   /etc/conf.modules or /etc/modules.conf file, which ever your system
  336.   uses, and add one of the following lines.
  337.  
  338.        options msbusmouse mouse_irq=3
  339.        options busmouse mouse_irq=3
  340.  
  341.   3.6.  The mouse devices.
  342.  
  343.   Mice under Linux are accessed via the devices in the /dev directory.
  344.   The following table gives a list of interface types and which device
  345.   you should use.
  346.  
  347.        INTERFACE        DEVICE        MAJOR    MINOR
  348.        ---------------------------------------------
  349.        Logitech        /dev/logibm      10      0
  350.        PS/2            /dev/psaux       10      1
  351.        Inport          /dev/inportbm    10      2
  352.        ATI-XL          /dev/atibm       10      3
  353.  
  354.            Table 1.  Mouse devices.
  355.  
  356.      Note:
  357.         If you are using your ATI-XL mouse with the Inport driver, you
  358.         should use the inportbm device, not the /dev/atibm device.
  359.  
  360.   The major and minor entries are the device numbers for that particular
  361.   device.
  362.  
  363.   If you find that you do not have these devices, you should create them
  364.   first.  To do so, execute the following as root.
  365.  
  366.        mknod /dev/logimm    c 10 0
  367.        mknod /dev/psaux     c 10 1
  368.        mknod /dev/inportbm  c 10 2
  369.        mknod /dev/atibm     c 10 3
  370.  
  371.      Note:
  372.         Some time in the (progressively less) recent history of Linux
  373.         the names for the busmouse devices have changed.  The following
  374.         device names have been superceded by those above and should be
  375.         removed: bmousems, bmouseps2, bmouseatixl, and bmouselogitech..
  376.  
  377.   Many people like to create a symbolic link from their mouse device to
  378.   /dev/mouse so that they don't have to remember which device they need
  379.   to be using.  If you have one of the current Linux distributions you
  380.   will almost certainly find that you have such a link.  If you have
  381.   such a link, or create one, you should make sure that it is pointing
  382.   to the correct device for your mouse.
  383.  
  384.   4.  Using your mouse.
  385.  
  386.   4.1.  gpm.
  387.  
  388.   Gpm is a program which allows you to do mouse based 'cut- and-paste'
  389.   between Linux virtual consoles, much like you can under X, and is a
  390.   good way of testing your mouse out. The current version of gpm is
  391.   gpm-1.13.tar.gz
  392.   <http://sunsite.unc.edu/pub/Linux/system/mouse/gpm-1.13.tar.gz> and
  393.   can be found at your friendly Linux FTP site (such as
  394.   sunsite.unc.edu), and contains instructions for getting it compiled.
  395.   Some Linux distributions, such as Red Hat, come with a precompiled gpm
  396.   binary.
  397.  
  398.   When invoking gpm, use the -t switch to indicate which protocol your
  399.   mouse is using and the -m option to indicate which mouse device you
  400.   are using.  Three protocols useful for most busmice are logi, bm, and
  401.   ps2.  The default for mouse device is to use /dev/mouse, so you can
  402.   omit the -m option if you have the appropriate symbolic link.  An
  403.   example for a Microsoft Inport mouse is:
  404.  
  405.        gpm -t bm
  406.  
  407.   or if you use the PS/2 protocol:
  408.  
  409.        gpm -t ps2
  410.  
  411.   You should then be able move your mouse and see a block move around
  412.   the screen and also be able to cut and paste text between virtual
  413.   consoles using the mouse buttons.  Read the documentation with gpm, or
  414.   do a ``man gpm'' for more information on how to operate it.
  415.  
  416.   4.2.  XFree86.
  417.  
  418.   To use your busmouse under XFree86, you will need to set your mouse
  419.   protocol type in your Xconfig file. If you have a BusMouse protocol
  420.   mouse, your Xconfig should contain (including the quotes)
  421.  
  422.   Section "Pointer"
  423.     Protocol "Busmouse"
  424.     Device   "/dev/mouse"
  425.  
  426.     # Any other options such as Emulate3Buttons
  427.   EndSection
  428.  
  429.   For PS/2 mice change the protocol line to:
  430.  
  431.          Protocol        "PS/2"
  432.  
  433.   If you have a two button mouse, it should also contain the line
  434.  
  435.          Emulate3Buttons
  436.  
  437.   which will allow you to emulate the use of the middle mouse button by
  438.   pressing both mouse buttons simultaneously.  All other mouse related
  439.   lines, such as ``BaudRate'' and ``SampleRate'' should be commented
  440.   out, as these have no effect on bus mice.
  441.  
  442.   4.3.  XFree86 and gpm.
  443.  
  444.   For a long period of the kernel developement, it was not possible to
  445.   share busmice between processes.  Because of this it was hard to run
  446.   both XFree86 and gpm at the same time. If you try to run X with gpm
  447.   running and you get errors like the following then you know you are
  448.   using one of these older kernels.
  449.  
  450.        Fatal server error:
  451.        Cannot open mouse (Device or resource busy)
  452.  
  453.   There are two meathods of getting gpm working with XFree86 with these
  454.   kernels.  The first is to kill any copy of gpm you have running before
  455.   you start up XFree86.  The second is to use gpm's "repeater" option
  456.   (it takes mouse data and repeats the information to multiple
  457.   applications).
  458.  
  459.   I would recommend upgrading your kernel if possible so that you can
  460.   share busmice between processes.  For this document, I will only
  461.   explain the simplest meathod of using XFree86 and gpm together with
  462.   older kernels.  Please see gpm's documentation if you would like to
  463.   use the repeater meathod.
  464.  
  465.   Gpm allows you to terminate running copies of itself by executing:
  466.  
  467.   gpm -k
  468.  
  469.   This should be done before starting up X11.  Take whatever script you
  470.   use to start up your X session, such as startx, and add the above com¡
  471.   mand to the top of the script so that gpm is shut down automatically.
  472.   You may wish to also put a command that restarts gpm at the bottom of
  473.   the script so that it restarts upon exiting your X session.
  474.  
  475.   5.  Still can't get your mouse going?
  476.  
  477.   So you've read through this howto a dozen times, done everything
  478.   exactly as you think you should have, and your mouse still doesn't
  479.   work?  The best advice I can give you is this: experiment.  Sure, it's
  480.   a pain in the posterior, but in the end the only way to find out what
  481.   is going to work with your mouse is to try all of the alternatives
  482.   until you have success.
  483.  
  484.   As always, if there is something you don't understand, try reading the
  485.   manual page first and see if that helps.  If you have a specific
  486.   question, or a problem you think I might be able to help with, feel
  487.   free to contact me at the address listed at the top of this howto, and
  488.   I'll see if I can help you out or point you to someone who can.
  489.  
  490.   The comp.os.linux.setup newsgroup or comp.os.linux.hardware is the
  491.   appropriate forum for discussion and/or questions regarding setup ---
  492.   please don't post questions to other groups, and especially don't
  493.   crosspost questions to two or more of the Linux groups, they are more
  494.   than cluttered enough as it is!  When posting, you will get a much
  495.   better response (and much fewer flames) if you use appropriate
  496.   Subject: and Keywords: lines.  For example:
  497.  
  498.        Subject: BUSMICE - Gateway 2000 mouse wont work.
  499.        Keywords: mouse busmouse gateway
  500.  
  501.